package com.wash.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wash.dao.UserMapper;
import com.wash.model.User;

@Service
public class UserService {

	@Autowired
	private UserMapper userMapper;
	
	/**
	 * 判断帐号是否已注册
	 * @param account
	 * @return
	 */
	public boolean hasRegister(String account){
		long count=userMapper.count(account);
		if(count>0){
			return true;
		}
		return false;
	}
	/**
	 * 根据用户名和密码查找用户
	 * @param phone
	 * @param password
	 * @return
	 */
	public User getUser(String phone,String password){
		User user=userMapper.getUser(phone,password);
		return user;
	}
	/**
	 * 添加用户
	 * @param user
	 */
	public void add(User user){
		userMapper.addEntity(user);
	}
}
